Loc()

Name-Index-Number Conversion Function

Syntax samples

LOC(<location name-index number>)

ORDER 10 EntA TO LOC(5)

DISPLAY "EntA arrived at" $ LOC(5)

Description

Converts a name-index number or integer to a location name. Use this function when a statement or function needs the name of a location but whose name-index number is stored in an attribute, variable, or some other expression. It can also be used to vary a selected location based on the name-index number stored in the expression. When used in a string expression, as in the second syntax example above, ProModel will convert the name-index number to the actual name of the location. If the expression points to a unit of a multi-unit location, then the LOC() function will return the name of the parent location.

Valid In

Any statement where a location name is normally used, including the Destination field of the Routing edit table. Also used in string expressions.

Components

<location name-index number>

The name-index number of the desired location. This component may be an expression, allowing the location to vary as the simulation progresses. Real numbers will be truncated to integers.

Example

Suppose there are five locations which appear one after the other in the Location edit table as follows: Dock1, Dock2, Dock3, Dock4, Dock5. Shipments could be ordered to each of the five locations in rotation with the following logic. Note that Dist() is a user-defined distribution that returns an integer value for the number of Shipments to order.

INT Var1 = 1

WHILE Var1 <= 5 DO

BEGIN

ORDER Dist() Shipments TO LOC(Var1)

INC Var1

END

See Also

ENT(), RES(), and LOCATION().